<?php

/*
 * 客户端
 */

require_once 'database.class.php';

$mysql = mysql::instance();

$table = 'user';
$fields = '*';
$where = array();
$where['username'] = 'ken';
$where['age'] = array('gt', 20);
$limit = 10;
$result = $mysql->table($table)->fields($fields)->where($where)->limit($limit)->select();
echo $result . '<br>';


$mysql = mysql::instance();

$table = 'member';
$fields = 'count(*)';
$where = array();
$where['username'] = 'bbb';
$where['age'] = array('gt', 2);
$limit = 5;
$result = $mysql->table($table)->fields($fields)->where($where)->limit($limit)->select();
echo $result;


$mysql = mysql::instance();

$table = 'member';
$data = array(
    'username' => 'ken',
    'age' => 23
);

echo $mysql->table($table)->insert($data);
